package lk.icta.common.entity;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author Kusal Samarakoon
 */
@Entity
@Table(schema = "COMMON_RAIL")
@NamedQueries({
        @NamedQuery(
                name = "getAllRailwayStationsByUserLanguage",
                query = "SELECT s FROM RailwayStation s"
        ),
        @NamedQuery(
                name = "getAllRailwayStationsByIpw",
                query = "SELECT s FROM RailwayStation s WHERE s.ipwZone.id = :ipwId"
        ),
        @NamedQuery(
                name = "getRailwayStationByCode",
                query = "SELECT s FROM RailwayStation s WHERE s.code = :code"
        )
})
public class RailwayStation implements Serializable {
    /**
     * A system generated unique key
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(updatable = false, unique = true, nullable = false)
    private int codeNo;

    @Column(updatable = false, unique = true, nullable = false)
    private String code;

    @Column(nullable = false, unique = true, updatable = false)
    private String stationSiName;
    @Column(nullable = false, unique = true, updatable = false)
    private String stationEnName;
    @Column(nullable = false, unique = true, updatable = false)
    private String stationTaName;

//    @Column(columnDefinition = "smallint not null default 1")
//    private boolean active;

    @ManyToOne
    @JoinColumn(nullable = false)
    private RailwayTrack railwayTrack;

    @ManyToOne
    @JoinColumn(nullable = false)
    private IPWZone ipwZone;

    @ManyToOne
    @JoinColumn(nullable = false)
    private RailwayProtectionZone railwayProtectionZone;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

//    public boolean isActive() {
//        return active;
//    }
//
//    public void setActive(boolean active) {
//        this.active = active;
//    }


    public int getCodeNo() {
        return codeNo;
    }

    public void setCodeNo(int codeNo) {
        this.codeNo = codeNo;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getStationSiName() {
        return stationSiName;
    }

    public void setStationSiName(String stationSiName) {
        this.stationSiName = stationSiName;
    }

    public String getStationEnName() {
        return stationEnName;
    }

    public void setStationEnName(String stationEnName) {
        this.stationEnName = stationEnName;
    }

    public String getStationTaName() {
        return stationTaName;
    }

    public void setStationTaName(String stationTaName) {
        this.stationTaName = stationTaName;
    }

    public RailwayTrack getRailwayTrack() {
        return railwayTrack;
    }

    public void setRailwayTrack(RailwayTrack railwayTrack) {
        this.railwayTrack = railwayTrack;
    }

    public IPWZone getIpwZone() {
        return ipwZone;
    }

    public void setIpwZone(IPWZone ipwZone) {
        this.ipwZone = ipwZone;
    }

    public RailwayProtectionZone getRailwayProtectionZone() {
        return railwayProtectionZone;
    }

    public void setRailwayProtectionZone(RailwayProtectionZone railwayProtectionZone) {
        this.railwayProtectionZone = railwayProtectionZone;
    }
}
